<template>
  <div>
    <h3>国内网站:粉丝数量:{{ fans | fansfliter(10000) }} 万</h3>
    <h3>国外网站:粉丝数量:{{ fans | fansfliter(1000) }} 千</h3>

    <h4>时间：{{ time | datamat('-') }}</h4>
    <h4>时间：{{ time | datamat('/') }}</h4>
  </div>
</template>

<script>
export default {
  data () {
    return {
      fans: 1876986,
      time: this.formatDate(new Date(1636450540055))
    }
  },

  created () {},
  filters: {
    fansfliter (val, num) {
      return val / num
    },
    datamat (val, str) {
      return val.toLocaleString().replace(/-/g, str)
    }
  },

  methods: {
    formatDate (now) {
      var year = now.getFullYear()
      var month = now.getMonth() + 1
      var date = now.getDate()
      return year + '-' + month + '-' + date
    }
  }
}
</script>

<style scoped lang="less"></style>
